package com.dyh.quickdemo.flux;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

@RequestMapping("/flux")
@RestController
@Slf4j
public class TestFluxController {
    private static  Flux flux = Flux.empty();
    Random random = new Random();

    @RequestMapping("/get")
    public Object get(){
        List<Long> longs = new ArrayList<>();
        longs.add(random.nextLong());
        longs.add(random.nextLong());
//        flux = Flux.fromIterable(longs);

        log.info("flux:{}",flux);
        return "ok";
    }
}
